package com.foreknow.demo21;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class LianXi {
    public static void main(String[] args) {
        //创建一个List集合
        List<Map> list =new ArrayList<>();

        //创建一个Map集合
        Map<String,Person> map1 = new HashMap<>();

        Person person1 = new Person();
        person1.setId(1);
        person1.setName("fender");

        Person person2 = new Person();
        person2.setId(2);
        person2.setName("jazz");

        map1.put("p1",person1);
        map1.put("p2",person2);

        Map<String,Person> map2 = new HashMap<>();

        Person person3 = new Person();
        person3.setId(1);
        person3.setName("fender");

        Person person4 = new Person();
        person4.setId(2);
        person4.setName("jazz");

        map2.put("p3",person3);
        map2.put("p4",person4);

        Map<String,Person> map3 = new HashMap<>();

        Person person5 = new Person();
        person3.setId(1);
        person3.setName("fender");

        Person person6 = new Person();
        person4.setId(2);
        person4.setName("jazz");

        map3.put("p5",person5);
        map3.put("p6",person6);

        list.add(map1);
        list.add(map2);
        list.add(map3);

        for(Map<String,Person> map:list){
            Person p =map.get("p2");
        }
    }
}
